package cn.brilliantfuture.commentry.entity;

// Generated 2011-11-3 13:34:34 by Hibernate Tools 3.3.0.GA

import static javax.persistence.GenerationType.IDENTITY;

import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.hibernate.validator.Length;
import org.hibernate.validator.NotNull;

/**
 * User generated by hbm2java
 */
@Entity
@Table(name = "user", catalog = "cabinet")
public class User implements java.io.Serializable {

	private static final long serialVersionUID = 1L;
	private Integer userId;
	private UserGroup userGroup;
	private Community community;
	private String name;
	private String password;
	private String comment;
	private String phone;
	private String email;
	private byte[] picture;
	private Boolean enable;
	private Date insertTime;
	private User insertUser;
	private boolean deleted;
	private boolean hasPic;
	private String nickname;
	private String hotline;
	private String orderHead;
	private String website;
	private Set<StorageGridUnlockRecord> storageGridUnlockRecords = new HashSet<StorageGridUnlockRecord>(0);

	public User() {
	}

	public User(UserGroup userGroup, Community community, String name, String password, boolean deleted, boolean hasPic) {
		this.userGroup = userGroup;
		this.community = community;
		this.name = name;
		this.password = password;
		this.deleted = deleted;
		this.hasPic = hasPic;
	}

	public User(UserGroup userGroup, Community community, String name, String password, String comment, String phone, String email, byte[] picture, Boolean enable, Date insertTime, User insertUser, boolean deleted, boolean hasPic, String nickname, String hotline, String orderHead, String website, Set<StorageGridUnlockRecord> storageGridUnlockRecords) {
		this.userGroup = userGroup;
		this.community = community;
		this.name = name;
		this.password = password;
		this.comment = comment;
		this.phone = phone;
		this.email = email;
		this.picture = picture;
		this.enable = enable;
		this.insertTime = insertTime;
		this.insertUser = insertUser;
		this.deleted = deleted;
		this.hasPic = hasPic;
		this.nickname = nickname;
		this.hotline = hotline;
		this.orderHead = orderHead;
		this.website = website;
		this.storageGridUnlockRecords = storageGridUnlockRecords;
	}

	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "user_id", unique = true, nullable = false)
	public Integer getUserId() {
		return this.userId;
	}

	public void setUserId(Integer userId) {
		this.userId = userId;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "group_id", nullable = false)
	@NotNull
	public UserGroup getUserGroup() {
		return this.userGroup;
	}

	public void setUserGroup(UserGroup userGroup) {
		this.userGroup = userGroup;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "community_id", nullable = false)
	@NotNull
	public Community getCommunity() {
		return this.community;
	}

	public void setCommunity(Community community) {
		this.community = community;
	}

	@Column(name = "name", nullable = false, length = 45)
	@NotNull
	@Length(max = 45)
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "password", nullable = false, length = 45)
	@NotNull
	@Length(max = 45)
	public String getPassword() {
		return this.password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	@Column(name = "comment", length = 500)
	@Length(max = 500)
	public String getComment() {
		return this.comment;
	}

	public void setComment(String comment) {
		this.comment = comment;
	}

	@Column(name = "phone", length = 11)
	@Length(max = 11)
	public String getPhone() {
		return this.phone;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}

	@Column(name = "email", length = 45)
	@Length(max = 45)
	public String getEmail() {
		return this.email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	@Column(name = "picture")
	public byte[] getPicture() {
		return this.picture;
	}

	public void setPicture(byte[] picture) {
		this.picture = picture;
	}

	@Column(name = "enable")
	public Boolean getEnable() {
		return this.enable;
	}

	public void setEnable(Boolean enable) {
		this.enable = enable;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "insert_time", length = 19)
	public Date getInsertTime() {
		return this.insertTime;
	}

	public void setInsertTime(Date insertTime) {
		this.insertTime = insertTime;
	}

	@Column(name = "deleted", nullable = false)
	public boolean isDeleted() {
		return this.deleted;
	}

	public void setDeleted(boolean deleted) {
		this.deleted = deleted;
	}

	@Column(name = "has_pic", nullable = false)
	public boolean isHasPic() {
		return this.hasPic;
	}

	public void setHasPic(boolean hasPic) {
		this.hasPic = hasPic;
	}

	@Column(name = "nickname", length = 45)
	@Length(max = 45)
	public String getNickname() {
		return this.nickname;
	}

	public void setNickname(String nickname) {
		this.nickname = nickname;
	}

	@Column(name = "hotline", length = 11)
	@Length(max = 11)
	public String getHotline() {
		return this.hotline;
	}

	public void setHotline(String hotline) {
		this.hotline = hotline;
	}

	@Column(name = "order_head", length = 100)
	@Length(max = 100)
	public String getOrderHead() {
		return this.orderHead;
	}

	public void setOrderHead(String orderHead) {
		this.orderHead = orderHead;
	}

	@Column(name = "website", length = 100)
	@Length(max = 100)
	public String getWebsite() {
		return this.website;
	}

	public void setWebsite(String website) {
		this.website = website;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "user")
	public Set<StorageGridUnlockRecord> getStorageGridUnlockRecords() {
		return this.storageGridUnlockRecords;
	}

	public void setStorageGridUnlockRecords(Set<StorageGridUnlockRecord> storageGridUnlockRecords) {
		this.storageGridUnlockRecords = storageGridUnlockRecords;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "insert_user")
	public User getInsertUser() {
		return insertUser;
	}

	public void setInsertUser(User insertUser) {
		this.insertUser = insertUser;
	}


}
